<!-- 考勤配卡新增 -->
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript"
	src="<c:url value="js/jquery-easyui-1.5.5.6/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="js/jquery-easyui-1.5.5.6/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="js/jquery-easyui-1.5.5.6/locale/easyui-lang-zh_CN.js"/>"></script>
<link id="theme" rel="stylesheet" type="text/css"
	href="<c:url value="js/jquery-easyui-1.5.5.6/themes/ui-cupertino/easyui.css"/>" />
<link rel="stylesheet" type="text/css"
	href="<c:url value="js/jquery-easyui-1.5.5.6/themes/icon.css"/>" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>考勤配卡新增</title>
</head>
<body>
	<script type="text/javascript">
		$(function() {
			//查询考勤卡
			$("#timecard_see").linkbutton({
				onClick:function(){
					var  seeText = $("#timecard_see_text").textbox('getText');
					$("#table_timecard").datagrid({url:'to_is_all_timecard_byId?timecardId='+seeText,method:'get'});
					$("#table_timecard").datagrid("reload");
				}
			});
			/* 清单查找 */
			$('#sheet_user_xinxis_timecard').textbox({
				icons : [ {
					iconCls : 'icon-add',
					handler : function(e) {
						$("#insert_timecard-staff").dialog("open");
						//双击获取值
						$('#q_leave_staff_dept').datagrid({onDblClickRow:function(index,row){
								$('#sheet_user_xinxis_timecard').textbox('setValue',row.STAIN_ID);
								$('#stainName_add_timecard').textbox('setValue',row.STAIN_NAME)
								//关闭窗口
								$('#insert_timecard-staff').dialog('close');
							}
						});
					}
				}]
			});
			/* 考勤卡查找 */
			$('#timecard_add').textbox({
				icons : [ {
					iconCls : 'icon-add',
					handler : function(e) {
						$("#inserttimecard").dialog("open");
						//双击获取值
						$('#table_timecard').datagrid({onDblClickRow:function(index,row){
							$('#timecard_add').textbox('setValue',row.TIMECARD_ID);
								//关闭窗口
								$('#inserttimecard').dialog('close');
							}
						});
					}
				}]
			});
			$('#leasheete').combobox({
				onLoadSuccess: function () {
					   $(this).combobox("select", '${leaves.holiday.holidayId}');
				  }
			});
			$('#guozhangriqila').combobox({
				onLoadSuccess: function () {
					   $(this).combobox("select", '${leaves.affaircategory.affcaType}');
				  }
			});
			//返回
			$('#return_timecard').linkbutton({
				onClick : function() {
					$("#shets_black").panel({
						href : "to_add_timecard_with_to"
					});
				}
			});
			//新增考勤配卡
			$(".submit_sheet_adde_timecard").linkbutton({onClick:function(){
				var stid =$("#sheet_user_xinxis_timecard").textbox("getText");
				var tid=$("#timecard_add").textbox("getText");
				var aedate=$("#sx_date").datetimebox("getText");
				var aldate=$("#sxdate").datetimebox("getText");
				var arson=$("#yuany_timecard").textbox("getText");
				var armk=$("#yuany_timecard_beizhu").textbox("getText");
				var stdate=$("#guozhangriqila").textbox("getText");
				if(stid.length==0||tid.length==0||aedate.length==0||aldate.length==0||stdate.length==0){
					$.messager.alert('提示','请把信息填写完整'); 
				}else{
					$.getJSON("is_add_timecard_whith",{
						"stainId":$("#sheet_user_xinxis_timecard").textbox("getText"),
						"timecardId":$("#timecard_add").textbox("getText"),
						"attcardEffect":$("#sx_date").datetimebox("getText"),
						"attcardLoseeff":$("#sxdate").datetimebox("getText"),
						"attcardReason": $("#yuany_timecard").textbox("getText"),
						"attcardRemarks": $("#yuany_timecard_beizhu").textbox("getText"),
						"attcardStartdate":$("#guozhangriqila").datetimebox("getText")
					},function(v){
						if(v.success){
							$("#shets_black").panel({
								href : "to_attendance_pk"
							});
						}else{
							$.messager.alert('错误', '对不起，操作失败，原因：' + v.message);
						}
					});
					
				}
			
			}});
		});
		
		//所有部门
		$('#with_card_dept_combobox').combobox({    
		    url:'is_to_all_depts',    
		    valueField:'DEFIDE_ID',    
		    textField:'DEFIDE_NAME'   
		});
		$('#with_card_dept_combobox').combobox({
			onSelect:function(record){
				$("#time_card_with_sousuo_text").textbox("setValue","");
				var dName=record.DEFIDE_NAME;
				$("#q_leave_staff_dept").datagrid({url:"is_to_dept_emp_alls?dName="+dName,method:'get'});
				
			}
		});
		
		$("#time_card_with_sousuo_button").linkbutton({
			onClick:function(){
				var Setext = $("#time_card_with_sousuo_text").textbox("getText");
				$('#with_card_dept_combobox').combobox("setValue","");
				$("#q_leave_staff_dept").datagrid({url:"is_to_all_emp_mohu?stainName="+Setext,method:'get'});
				$("#q_leave_staff_dept").datagrid("reload");
			}
		});
	</script>
<div id="shets_black" class="easyui-panel" data-options="fit:true,border:false">
<form action="" id="htmikk"method="post">
	
		<div style="margin: 15px">
			<div id="" class="" style="margin: 10px">
				<a href="#" id="return_timecard" class="easyui-linkbutton return_timecard" iconCls="icon-reload"
					plain="true" title="返回" data-options="text:'返回'"></a> <a
					class="easyui-linkbutton submit_sheet_adde_timecard" 
					data-options="text:'确定',iconCls:'icon-add',plain:true"></a> <span
					style="float: right; font-size: 12px; margin-top: 5px;">新增：考勤配卡</span>
			</div>

			<div style="font-size: 14px;">概要</div>
			<div style="border-top: 2px solid #19aa8d; width: 400px;height:180px; display: inline-block;">
				<table cellspacing="10">
					<tbody>
						<tr>
							<td><input class="easyui-textbox" id="dess"value='0'data-options="label:'*编号', width:300,labelWidth:130,readonly:true" />
							</td>
						</tr>
						<tr>
							<td><input class="easyui-textbox" name=""  value='' id="sheet_user_xinxis_timecard"
								data-options="label:'*员工编号', width:300,labelWidth:130" 
								/></td>
						</tr>
						<tr>
							<td><input class="easyui-textbox" value=''id="stainName_add_timecard" data-options="label:'*员工名称', width:300,labelWidth:130,readonly:true" />
							</td>
						</tr>
						<tr>
							<td><input class="easyui-textbox" value=''id="timecard_add" data-options="label:'*考勤卡', width:300,labelWidth:130" />
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div
				style="border-top: 2px solid #19aa8d; height:180px;width: 400px; display: inline-block; margin-left: 10px">
				<table cellspacing="10">
					<tbody>
						<tr>
							<td><input id="guozhangriqila" class="easyui-datetimebox" name=""
								data-options="label:'过账日期',plain:true,panelHeight:'auto',width:300,labelWidth:130"
								/></td>
						</tr>
						<tr>
							<td>
							<input id="sx_date" class="easyui-datetimebox" name=""   
   							 data-options="label:'生效日期',plain:true,panelHeight:'auto',width:300,labelWidth:130"/>
							
						</td>
						</tr>
						<tr>
							<td><input id="sxdate" value=""class="easyui-datetimebox"
								data-options="label:'失效日期', width:300,labelWidth:130,value:'2099-12-31 23:59:59',readonly:true" /></td>
						</tr>
						
					</tbody>
				</table>
			</div>
			<div style="font-size: 14px;">原因</div>
			<div
				style="border-top: 2px solid #19aa8d; width: 800px; height: 130px; display: inline-block; margin-right: 15px; padding-top: 10px;">
				<input id="yuany_timecard"value=""class="easyui-textbox"
					data-options="width:800,height:100,multiline:true" />
			
			
			
		
		</div>
		<div style="font-size: 14px;">备注</div>
			<div
				style="border-top: 2px solid #19aa8d; width: 800px; height: 130px; display: inline-block; margin-right: 15px; padding-top: 10px;">
				<input id="yuany_timecard_beizhu"value=""class="easyui-textbox"
					data-options="width:800,height:100,multiline:true" />
			
			
			
		
		</div>
	</div>
	</form>
	<div>
		<form action="" id="f_staff_dept"></form>
		<form action="" id="f_staff_dept1"></form>
	</div>
		
			<!--清单查找所有员工-->
		<div id="insert_timecard-staff" class="easyui-dialog"
		data-options="
		width:450,
		title:'清单查找-员工配卡',
		bodyCls:'awby',
		modal:true,
		closed:true,
		buttons:[{
				text:'添加',
				iconCls:'icon-ok',
				handler:function(){
					$('#f_staff_dept1').form({
							onSubmit:function(){
								var rows=$('#q_leave_staff_dept').datagrid('getSelected');
								if(rows!=null){
								$('#sheet_user_xinxis_timecard').textbox('setValue',rows.STAIN_ID);
								$('#stainName_add_timecard').textbox('setValue',rows.STAIN_NAME);
								$('#insert_timecard-staff').dialog('close');	   
								}else{
									$.messager.alert('提示','请选择员工'); 
								}
								
								
							},
							success:function(v){
								
								
							}
						}).submit();
				}
			},{
				text:'关闭',
				iconCls:'icon-cancel',
				handler:function(){
					$('#insert_timecard-staff').dialog('close');
				}
			}]">
				<div>
					<form action=""  id="staff_dept_suosou">
						<table id="list_lookup_staff_dept" >
							
							<tr>
								<td><input id="time_card_with_sousuo_text" class="easyui-textbox"
									data-options="label:'员工姓名', width:200,labelWidth:90" /></td>
									<td>&nbsp;&nbsp;&nbsp;<a class="easyui-linkbutton" id="time_card_with_sousuo_button">模糊查询</a></td>
							</tr>
							
							<tr>
								<td><input id="with_card_dept_combobox" class="easyui-combobox"
									data-options="label:'部门', width:200,labelWidth:90,panelHeight:'auto'" /></td>
							</tr>
							
						</table>
					</form>
				</div>
				<table class="easyui-datagrid"  id="q_leave_staff_dept"
					data-options="   
				method:'post',
				pagination:true,     
				pageSize:5,
				
				pagePosition:'bottom', 
				url:'is_to_all_staffanddept',  
				pageList: [5,10,15,20,25], 
				rownumbers:true,
				Striped:true, 
				singleSelect:true,
				striped:true
				">
					<thead>
						<tr>
							<th data-options="field:'STAIN_ID',width:90,align:'center'">员工编号</th>
							<th data-options="field:'STAIN_NAME',width:130,align:'center'">员工名称</th>
							<th data-options="field:'DEFIDE_NAME',width:140,align:'center'">部门</th>
						</tr>
					</thead>
					<tbody>
						
					</tbody>
				</table>
			</div>
			
			
			
			
		<!--考勤卡查找-->
		<div id="inserttimecard" class="easyui-dialog"
		data-options="
		width:450,
		title:'清单查找-考勤卡',
		bodyCls:'awby',
		modal:true,
		closed:true,
		buttons:[{
				text:'添加',
				iconCls:'icon-ok',
				handler:function(){
					$('#f_staff_dept').form({
							onSubmit:function(){
								var rows=$('#table_timecard').datagrid('getSelected');
								if(rows!=null){
									$('#timecard_add').textbox('setValue',rows.TIMECARD_ID);
									$('#inserttimecard').dialog('close');
								}else{
									$.messager.alert('提示','请选择考勤卡'); 
								}
								
							},
							success:function(v){
								
							}
						}).submit();
				}
			},{
				text:'关闭',
				iconCls:'icon-cancel',
				handler:function(){
					$('#inserttimecard').dialog('close');
				}
			}]">
				<div>
					<form action="" >
						<table id="list_timecard">
							<tr>
								<td><input class="easyui-textbox"
									data-options="label:'编号', width:200,labelWidth:60" id="timecard_see_text"/></td>
									<td><a class="easyui-linkbutton" id="timecard_see">查询</a></td>
							</tr>
						
							
						</table>
					</form>
				</div>
				<table class="easyui-datagrid" id="table_timecard"
					data-options="   
				method:'post',
				pagination:true,     
				pageSize:5, 
				pagePosition:'bottom',   
				url:'is_to_all_timecards',  
				pageList: [5,10,15,20,25], 
				rownumbers:true,
				Striped:true, 
				singleSelect:true,
				striped:true
				">
					<thead>
						<tr>
							<th data-options="field:'TIMECARD_ID',width:200">考勤卡</th>
							
						</tr>
					</thead>
					<tbody>

					</tbody>
				</table>
			</div>
			
			
			<div style="margin-left:20px;">
				<a
					class="easyui-linkbutton submit_sheet_adde_timecard" 
					data-options="text:'确定',iconCls:'icon-ok'"></a>
			</div>
		
	</div>
</body>
</html>